<%@page language="java" pageEncoding="UTF-8"%>
<%@include file="/views/common/include/taglib.jsp"%>
<link type="text/css" rel="stylesheet"
	href="${ctx }/css/dlifestyle/sectionparent.css" source="widget" />
<link type="text/css" rel="stylesheet"
	href="${ctx }/css/dlifestyle/admin.css" source="widget" />
<section>
	<div style="height: 40px; line-height: 40px;">
		<div class="forword_area"></div>
		<div class="location">当前位置：${sessionScope.currcent_position}</div>
	</div>
	<hr>
	<div class="panel panel-default">
		<div class="editTitle">
			<div style="height: 41px; width: 190px; float: left;">
				<img style="float: left; margin-left: 37px; margin-top: 9.5px;"
					src="${ctx}/images/new_edit.png" />
				<h4>查看优惠券信息</h4>
			</div>
			<div>
				<a style="float: right; margin-right: 20px; margin-top: -2px;"
					title="关闭" onclick="cancel();"><img
					src="${ctx}/images/new_close.png" /></a>
			</div>
		</div>

		<div id="replyList" class="right"
			style="height: 150px; margin-top: -10px;">
			<div class="modal-header">

				<div id="form" class="form"
					style="min-height: 50px; margin-top: 10px; border-top: 1px solid #edeef3; font-size: 14px;">
					<c:if test="${couponInfo.userAccountType == 2}">
						<div class="itemEdit" style="border-bottom: 1px solid #CBD5DD;">
							<span class="col-sm-1 editlableDetail" style="font-size: 14px;">小区名：</span>
							<div class="fldetail-4l">${couponInfo.cellName}</div>
							<span class="col-sm-1 editlableDetail" style="font-size: 14px;">店铺名：</span>
							<div class="fldetail-4r">${couponInfo.shopName}</div>
						</div>
					</c:if>
					<div class="itemEdit" style="border-bottom: 1px solid #CBD5DD;">
						<span class="col-sm-1 editlableDetail" style="font-size: 14px;">优惠券名称：</span>
						<div class="fldetail-4l">${couponInfo.name}</div>
						<span class="col-sm-1 editlableDetail" style="font-size: 14px;">优惠券类型：</span>
						<div class="fldetail-4r">
							<c:if test="${couponInfo.type == 1}">平台新人券</c:if>
							<c:if test="${couponInfo.type == 2}">平台邀请券</c:if>
							<c:if test="${couponInfo.type == 3}">满减券</c:if>
							<c:if test="${couponInfo.type == 4}">商家免运费券</c:if>
						</div>
					</div>
					<div class="itemEdit" style="border-bottom: 1px solid #CBD5DD;">
						<span class="col-sm-1 editlableDetail" style="font-size: 14px;">减免线：</span>
						<div class="fldetail-4l">${couponInfo.breakLine}</div>
						<span class="col-sm-1 editlableDetail" style="font-size: 14px;">减免金额：</span>
						<div class="fldetail-4r">${couponInfo.breakPrice}</div>
					</div>
					<div class="itemEdit" style="border-bottom: 1px solid #CBD5DD;">
						<span class="col-sm-1 editlableDetail" style="font-size: 14px;">领取有效期：</span>
						<div class="fldetail-4l">${couponInfo.beginDate}&nbsp;&nbsp;至&nbsp;&nbsp;${couponInfo.endDate}</div>
						<span class="col-sm-1 editlableDetail" style="font-size: 14px;">使用有效期：</span>
						<div class="fldetail-4r">${couponInfo.useBeginDate}&nbsp;&nbsp;至&nbsp;&nbsp;${couponInfo.useEndDate}</div>
					</div>
					<div class="itemEdit" style="border-bottom: 1px solid #CBD5DD;">
						<span class="col-sm-1 editlableDetail" style="font-size: 14px;">数量：</span>
						<div class="fldetail-4l">${couponInfo.count}</div>
						<span class="col-sm-1 editlableDetail" style="font-size: 14px;">发布账号：</span>
						<div class="fldetail-4r">${couponInfo.userAccount}</div>
					</div>
					<div class="itemEdit" style="border-bottom: 1px solid #CBD5DD;">
						<span class="col-sm-1 editlableDetail" style="font-size: 14px;">发布账户类型：</span>
						<div class="fldetail-4l">
							<c:if test="${couponInfo.userAccountType == 1}">平台</c:if>
							<c:if test="${couponInfo.userAccountType == 2}">商户</c:if>
						</div>
						<span class="col-sm-1 editlableDetail" style="font-size: 14px;">状态：</span>
						<div class="fldetail-4r">
							<c:if test="${couponInfo.state == 1}">新申请</c:if>
							<c:if test="${couponInfo.state == 2}">正常</c:if>
							<c:if test="${couponInfo.state == 3}">禁用</c:if>
							<c:if test="${couponInfo.state == 4}">审核未通过</c:if>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</section>
<section style="margin-top: 260px">
	<div class="panel" style="height:auto">
		<div class="btn-group">
			<input id="couponid" type="hidden" value="${couponInfo.id }">
			<select id="couponstate"
				style="list-style-type: none; height: 28px; min-width: 150px; z-index: 99; color: #b5b1b1; border: none; font-size: 12px; border-radius: 10px;">
				<option value="-1"
					<c:if test="${couponstate == -1 }"> selected="selected"</c:if>>&nbsp;&nbsp;&nbsp;优惠券状态</option>
				<option value="2"
					<c:if test="${couponstate == 2 }"> selected="selected"</c:if>>&nbsp;&nbsp;&nbsp;已下发</option>
				<option value="3"
					<c:if test="${couponstate == 3 }"> selected="selected"</c:if>>&nbsp;&nbsp;&nbsp;已使用</option>
			</select>
		</div>
		<div class="btn-group">
			<select
				style="list-style-type: none; height: 28px; min-width: 150px; z-index: 99; color: #b5b1b1; border: none; font-size: 12px; border-radius: 10px;"
				id="pSize">
				<c:forEach items="${pageSizes }" var="item">
					<option value="${item.value }"
						<c:if test="${pSize == item.value }">selected</c:if>>&nbsp;&nbsp;&nbsp;${item.label }</option>
				</c:forEach>
			</select>
		</div>
		<div style="margin-left: 30px" class="search"
			onclick="getCouponDetailList();">
			<img src="${ctx }/images/table/search_second.png">
		</div>
		<div
			style="width: 45px; height: 25px; margin-left: 10px; padding-top: 3px; padding-left: 10px; background-color: #37ced4; color: white; cursor: pointer; float: left;"
			onclick="exportExcel();">导出</div>
		<%--  <div style="margin-right: 5px" class="delete"  style="float:left;" onclick="deleteByIds();"><img src="${ctx }/images/table/del_second.png"></div>  --%>
	</div>
	<div class="ddd" style="height: 28px;">
		<table class="table">
			<thead>
				<tr>
					<%--  <th width="4%">
                             <img src="${ctx }/images/tables/tubiao.png" style="left:-5px">
                             <span>
                             <img id="all" onclick="selectAll(this)" src="${ctx }/images/tables/wugou.png" style="margin-bottom: 1px;">
                             </span>
                        </th> --%>
					<th width="3%">序号</th>
					<th width="10%">优惠券名称</th>
					<th width="8%">优惠券编码</th>
					<th width="10%">优惠券状态</th>
					<th width="7%">电话</th>
					<th width="7%">手机IMEI号</th>
					<th width="7%">用户账号</th>
					<th width="10%">使用时间</th>
					<th width="10%">过期时间</th>
					<th width="10%">创建时间</th>
				</tr>
			</thead>
			<tbody id="tableTbody">
				<c:forEach items="${couponDetail.list }" var="couponDetail"
					varStatus="couponDetailStatus">
					<tr onmouseover="mouseoverOne(this)" onmouseout="mouseoutOne(this)">
						<%-- <td>
	                      	<img id="user${couponDetail.id}" name="couponDetailChecked" class="${couponDetail.id}" 
	                      	onclick="selectOne(${couponDetail.id},this)" src="${ctx}/images/tables/wugou.png">
	                      	</td> --%>
						<td>${couponDetailStatus.index + 1 }</td>
						<td>${couponDetail.couponName}</td>
						<td>${couponDetail.code}</td>
						<td><c:choose>
								<c:when test="${couponDetail.state == 1}">已生成</c:when>
								<c:when test="${couponDetail.state == 2}">已下发</c:when>
								<c:when test="${couponDetail.state == 3}">已使用</c:when>
								<c:otherwise>
								</c:otherwise>
							</c:choose></td>
						<td>${couponDetail.phone}</td>
						<td>${couponDetail.imei}</td>
						<td>${couponDetail.userAccount}</td>
						<td><fmt:formatDate value="${couponDetail.useTime}"
								pattern="yyyy-MM-dd HH:mm" /></td>
						<td><fmt:formatDate value="${couponDetail.expireTime}"
								pattern="yyyy-MM-dd HH:mm" /></td>
						<td><fmt:formatDate value="${couponDetail.createTime}"
								pattern="yyyy-MM-dd HH:mm" /></td>
					</tr>
				</c:forEach>
			</tbody>
			<tfoot>
				<tr>
					<td colspan="10">
						<div>
							<div style="float: left;">
								<span class="total">合计 ${couponDetail.total} 条数据</span> <input
									type="hidden" value="${couponDetail.total}" id="total">
							</div>
							<div style="float: right; margin-right: 10px; margin-top: 26px">
								<div style="float: left;">
									<ul class="footer_ul">
										<c:if test="${couponDetail.hasPreviousPage }">
											<li onclick="gotoPage(${currentPage-1 });"><a
												class="leftRight">&lt;&lt;</a></li>
										</c:if>
										<c:forEach items="${couponDetail.navigatepageNums }"
											var="page">
											<li onclick="gotoPage(${page });"
												class="<c:if test="${currentPage == page }">active</c:if>"
												style="border: 1px solid #9A9A9A;"><a>${page}</a></li>
										</c:forEach>
										<c:if test="${couponDetail.hasNextPage }">
											<li><a onclick="gotoPage(${currentPage+1});"
												class="leftRight">&gt;&gt;</a></li>
										</c:if>
									</ul>
								</div>
								<div style="float: left; height: 30px; line-height: 30px;">
									<span style="color: #9A9A9A;">跳转到</span> <input
										class="inputclass" id="pageNo"
										onkeydown="if(event.keyCode==13){event.keyCode=0;return false;}"
										type="text" value="${currentPage }"
										style="width: 26px; height: 28px"> <span
										style="color: #9A9A9A;">页</span> <span class="buttonclass"
										id="J_JumpTo" onclick="gotoCouponDetailPage(null);"><a>GO</a></span>
								</div>
							</div>
						</div>
					</td>
				</tr>
			</tfoot>
		</table>
	</div>
	<div style="text-align: center;">
		<button style="margin-top: 20px;" class="buttonCancle"
			onclick="cancel();">返&nbsp;&nbsp;回</button>
	</div>
	<%@include file="/views/common/footer.jsp"%>
</section>

<script
	src="${ctx}/js/controllers/mall/couponinfo/CouponDetailController.js"
	type="text/javascript">
	</script>
<script type="text/javascript">
		var ctx = '${ctx}';
		setCtx(ctx);
		
		//实现选中取消切换图片
		$("tbody td>img").toggle(function(){    
		    $(this).attr("src","${ctx }/images/tables/honggou.png"); 
		    //$(this).parents("tr").children().each(function(){
			   // $(this).css("background","#D3F0F1");
		   //});    
		},function(){    
		    $(this).attr("src", "${ctx }/images/tables/wugou.png"); 
		    //$(this).parents("tr").children().each(function(){
			    //$(this).css("background","");
		   //});
		    });
		    
		//实现全选切换所有选项图标
		$("#all").toggle(function(){    
		    $(this).attr("src","${ctx }/images/tables/honggou.png"); 
		    $("tbody td>img").attr("src","${ctx }/images/tables/honggou.png");  
		},function(){    
		    $(this).attr("src", "${ctx }/images/tables/wugou.png"); 
		    $("tbody td>img").attr("src","${ctx }/images/tables/wugou.png");  
		    });
	</script>
